# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>

# Bundled libraries used in the package:
#
# Name         | License       | Location
# -------------+---------------+---------
# aes-gladman  | custom / GPL  | Source/ThirdParty/aes-gladman
# base64       | unknown       | Source/ThirdParty/base64
# hmac-gladman | custom / GPL  | Source/ThirdParty/hmac-gladman
# jni          | Apache-2.0    | Source/ThirdParty/jni
# md5          | Public domain | Source/ThirdParty/md5
# sha1-gladman | custom / GPL  | Source/ThirdParty/sha1-gladman
# sha2-gladman | custom / GPL  | Source/ThirdParty/sha2-gladman
# tfsxml       | unknown       | Source/ThirdParty/tfsxml

pkgname=libmediainfo
pkgver=23.11
pkgrel=1
pkgdesc="Shared library for mediainfo"
url="https://github.com/MediaArea/MediaInfoLib"
arch="all"
license="BSD-2-Clause"
depends_dev="libzen-dev zlib-dev"
makedepends="$depends_dev
	cmake
	curl-dev
	libmms-dev
	samurai
	tinyxml2-dev
	"
subpackages="$pkgname-dev"
source="https://mediaarea.net/download/source/libmediainfo/$pkgver/libmediainfo_$pkgver.tar.xz"
builddir="$srcdir/MediaInfoLib"
options="!check"  # upstream does not provide tests

prepare() {
	default_prepare
	rm -rf Project/MS*

	# Make sure that these bundled libs are not used.
	rm -R Project/zlib
	rm -R Source/ThirdParty/tinyxml2
}

build() {
	cmake -G Ninja -S Project/CMake -B build \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		-DBUILD_SHARED_LIBS=ON
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
8801146063524783bda61d2fd9d55d8176b914953a11e9ece93d36729f4bb195bf882f3061b0f4e508509e0c956da2c953b96e0100e1873d64cf44e5d29c5ffc  libmediainfo_23.11.tar.xz
"
